﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hr.DAL;
using Hr.Model;

namespace Hr.BLL
{
    public class WageService
    {
        //引入wageDal 层并实例化
        //bll层调用dal层方法，控制器调用bll层方法
        protected WageDAL wage=new WageDAL();

        /// <summary>
        /// 获取所有薪资信息集合
        /// </summary>
        /// <returns></returns>
        public IEnumerable<Wage_List> GetAttendanceListAll(DateTime SelTime)
        {
            //调用dal层方法
            return wage.GetAttendceListAll(SelTime);
        }

        /// <summary>
        /// 根据FullName查询Wage_List表数据
        /// </summary>
        /// <returns></returns>
        public IEnumerable<Wage_List> FNameSelectWageList(string FullName)
        {
            return wage.FNameSelectWageList(FullName);

        }

        /// <summary>
        /// 获取需要添加的数据，修改数据
        /// </summary>
        public bool UpdateWageList(Wage_List r, int pk_User,string type)
        {
            wage.UpdateWageList(r,pk_User, type);
            return wage.SaveChanges();
        }
        /// <summary>
        /// 根据薪资ID，获取薪资信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Wage_List GetWageInfo(int id)
        {
            return wage.GetWageInfo(id);//调用Dal层的GetRoleName方法
        }
        /// <summary>
        /// 获取薪资全年的数据
        /// </summary>
        /// <returns></returns>
        public List<Dictionary<string, string>> GetChartInfo()
        {
            return wage.GetChartInfo();
        }
        /// <summary>
        /// 获取薪资去年的数据
        /// </summary>
        /// <returns></returns>
        public List<Dictionary<string, string>> GetChart()
        {
            return wage.GetChart();
        }

        /// <summary>
        /// 根据角色名称，进行模糊查询，返回集合
        /// </summary>
        /// <param name="RoleName_CHS"></param>
        /// <returns></returns>
        public List<Wage_List> SelWageList(string WageList_CHS)
        {
            return wage.SelWageList(WageList_CHS);
        }
        /// <summary>
        /// 删除薪资信息
        /// </summary>
        /// <param name="pk_Name"></param>
        /// <returns></returns>
        public bool DelWagedata(int pk_wage)
        {
            wage.DelWagedata(wage.GetWageInfo(pk_wage));
            return wage.SaveChanges();
        }
    }
}
